<form name="contractEditProductForm" class="form-horizontal" novalidate style="width:1000px;">
    <div class="form-group mt10 clearfix">
        <span class="col-sm-3 control-label">产品名称</span>
        <div ng-if="isAuto" class="col-sm-9">
            <span class="form-control">
                {{data.applicationName}}
            </span>
        </div>
        <div ng-if="!isAuto" class="col-sm-9">
            <input select2 required ng-model="data.ApplicationId" name="ApplicationId" select2-model="ddl2Project" config="ddlConfigProjects" ng-disabled="!isAdd" class="form-control" type="text" placeholder="产品名称" />
            <span role="alert" ng-show="(contractEditProductForm.$submitted || contractEditProductForm.ApplicationId.$touched) && contractEditProductForm.ApplicationId.$error.required" class="error c-red lh30">请选择产品名称</span>
        </div>
        <span for="inputtext3" class="col-sm-3 control-label">出库单号</span>
        <div class="col-sm-9">
            <input type="text" class="fl form-control" style="width:100%" name="OrderCode" ng-model="data.OrderCode" placeholder="出库单号" ng-disabled="data.OrderGUID != '' && data.OrderGUID != null"/>
        </div>
    </div>
    <div class="form-group mt10 clearfix">
        <span for="inputtext3" class="col-sm-3 control-label">业绩核算时间</span>
        <div class="col-sm-9">
            <input type="text" class="input-date fl form-control" style="width:100%" ui-date format="yyyy-MM-dd" required name="establishTime"
                   ng-model="data.establishTime" placeholder="业绩核算时间"
            />
            <span role="alert" ng-show="(contractEditProductForm.$submitted || contractEditProductForm.establishTime.$touched) && contractEditProductForm.establishTime.$error.required"
                  class="error c-red lh30">业绩核算时间</span>
        </div>

        <span for="inputtext3" class="col-sm-3 control-label">开通时间</span>
        <div class="col-sm-9">
            <input type="text" class="input-date fl form-control" style="width:100%" ui-date format="yyyy-MM-dd" required name="performanceAccountingTime"
                   ng-model="data.performanceAccountingTime" placeholder="开通时间"
            />
            <span role="alert" ng-show="(contractEditProductForm.$submitted || contractEditProductForm.establishTime.$touched) && contractEditProductForm.establishTime.$error.required"
                  class="error c-red lh30">开通时间不能为空</span>
        </div>
    </div>
    <div class="form-group mt10 clearfix">
        <span for="inputtext3" class="col-sm-3 control-label">授权项目</span>
        <div class="col-sm-9">
            <input type="number" required number min="0" max="{{maxAuthorizationNum}}" class="fl form-control" style="width:100%" required name="totalNum" ng-model="data.totalNum"  placeholder="授权项目" ng-disabled="isAuto"/>
            <span role="alert" ng-show="(contractEditProductForm.$submitted || contractEditProductForm.totalNum.$touched) && contractEditProductForm.totalNum.$error.required"
                class="error c-red lh30">授权项目不能为空</span>
            <span role="alert"
                  ng-show="(contractEditProductForm.$submitted || contractEditProductForm.totalNum.$touched) && contractEditProductForm.totalNum.$error.max"
                  class="error ng-hide c-red lh30">授权项目不能超过上限{{maxAuthorizationNum}}</span>
        </div>
        <span for="inputtext3" class="col-sm-3 control-label">租期</span>
        <div class="col-sm-4">
            <input type="text" class="input-date fl form-control" style="width:100%" ui-date format="yyyy-MM-dd" name="beginOn" ng-required="!isAuto"
                   id="begin_on"
                   max-date="#F{$dp.$D(\'end_on'\)}" ng-model="data.beginOn" placeholder="开始时间"
            />
            <span role="alert" ng-show="(contractEditProductForm.$submitted || contractEditProductForm.beginOn.$touched) && contractEditProductForm.beginOn.$error.required"
                  class="error c-red lh30">开始时间不能为空</span>
        </div>
        <div class="col-sm-4">
            <input type="text" class="input-date fl form-control" style="width:100%" ui-date format="yyyy-MM-dd" name="endOn" ng-required="!isAuto"
                   id="end_on"
                   min-date="#F{$dp.$D(\'begin_on'\)}" ng-model="data.endOn" placeholder="结束时间"
            />
            <span role="alert" ng-show="(contractEditProductForm.$submitted || contractEditProductForm.endOn.$touched) && contractEditProductForm.endOn.$error.required"
                  class="error c-red lh30">结束时间不能为空</span>
        </div>
    </div>
    <div class="form-group mt10 clearfix">
        <span class="col-sm-3 control-label">结算类型</span>
        <div class="col-sm-9">
            <input select2 ng-model="data.SettlementType" ng-disabled="readOnly" required name="settlement_type" select2-model="ddl2SettlementType" config="ddlConfigSettlementType"
                   class="form-control" type="text" placeholder="结算类型" />
            <span role="alert" ng-show="(contractEditProductForm.$submitted || contractEditProductForm.settlement_type.$touched) && contractEditProductForm.settlement_type.$error.required"
                  class="error ng-hide c-red lh30">结算类型不能为空</span>
        </div>
        <span class="col-sm-3 control-label">合同属性</span>
        <div class="col-sm-9">
            <input select2 ng-model="data.contract_type" required name="contract_type" select2-model="ddl2ContractType" config="ddlConfigContractType"
                   class="form-control" type="text" placeholder="合同属性"
                   ng-disabled="isAuto"
            />
            <span role="alert" ng-show="(contractEditProductForm.$submitted || contractEditProductForm.contract_type.$touched) && contractEditProductForm.contract_type.$error.required"
                  class="error c-red lh30">合同属性不能为空</span>
        </div>
    </div>
    <div class="form-group mt10 clearfix">

        <span class="col-sm-3 control-label">结算比例(%)</span>
        <div class="col-sm-9">
        <input type="number" required number min="0" ng-disabled="readOnly" ng-model="data.settlement_scale" name="settlement_scale" class="form-control"
        placeholder="结算比例" />
        <span role="alert" ng-show="(contractEditProductForm.$submitted || contractEditProductForm.settlement_scale.$touched) && contractEditProductForm.settlement_scale.$error.required"
        class="error ng-hide c-red lh30">结算比例不能为空</span>
        <span role="alert" ng-show=" contractEditProductForm.settlement_scale.$error.number" class="error ng-hide c-red lh30">结算比例必须是数值类型</span>
        <span role="alert" ng-show=" contractEditProductForm.settlement_scale.$error.min" class="error ng-hide c-red lh30">结算比例必须大于等于0</span>
        </div>

        <span class="col-sm-3 control-label" ng-if="data.settlement_type==2">折扣(%)</span>
        <div class="col-sm-9" ng-if="data.settlement_type==2">
        <input type="number" required number min="0" ng-disabled="readOnly" ng-model="data.discount" name="discount" class="form-control" placeholder="折扣"
        />
        <span role="alert" ng-show="(contractEditProductForm.$submitted || contractEditProductForm.discount.$touched) && contractEditProductForm.discount.$error.required"
        class="error ng-hide c-red lh30">折扣不能为空</span>
        <span role="alert" ng-show=" contractEditProductForm.discount.$error.number" class="error ng-hide c-red lh30">折扣必须是数值类型</span>
        <span role="alert" ng-show=" contractEditProductForm.discount.$error.min" class="error ng-hide c-red lh30">折扣必须大于等于0</span>
        </div>
    </div>
    <div class="form-group mt10 clearfix">

        <span class="col-sm-3 control-label">结算基准单价</span>
        <div class="col-sm-9">
            <input type="number" required number min="0" ng-model="data.benchmark_amount" name="benchmark_amount" class="form-control" id="inputBenchmarkSingleAmount"
                   placeholder="结算基准单价" />

            <span role="alert" ng-show="(contractEditProductForm.$submitted || contractEditProductForm.benchmark_amount.$touched) && contractEditProductForm.benchmark_amount.$error.required"
                  class="error ng-hide c-red lh30">结算基准单价不能为空</span>
            <span role="alert" ng-show=" contractEditProductForm.benchmark_amount.$error.number" class="error ng-hide c-red lh30">结算基准单价必须是数值类型</span>
            <span role="alert" ng-show=" contractEditProductForm.benchmark_amount.$error.min" class="error ng-hide c-red lh30">结算基准单价必须大于等于0</span>
        </div>

        <span class="col-sm-3 control-label">结算基准价</span>
        <div class="col-sm-9">
            <input type="number" required number min="0" ng-disabled="true" ng-model="data.benchmark_sum_amount" name="benchmark_sum_amount" class="form-control" id="inputBenchmarkAmount"
                   placeholder="结算基准价" />

            <span role="alert" ng-show="(contractEditProductForm.$submitted || contractEditProductForm.benchmark_sum_amount.$touched) && contractEditProductForm.benchmark_sum_amount.$error.required"
                  class="error ng-hide c-red lh30">结算基准价不能为空</span>
            <span role="alert" ng-show=" contractEditProductForm.benchmark_sum_amount.$error.number" class="error ng-hide c-red lh30">结算基准价必须是数值类型</span>
            <span role="alert" ng-show=" contractEditProductForm.benchmark_sum_amount.$error.min" class="error ng-hide c-red lh30">结算基准价必须大于等于0</span>
        </div>

    </div>
    <div class="form-group mt10 clearfix">
        <span class="col-sm-3 control-label">区域折扣(%)</span>
        <div class="col-sm-9">
            <input type="number" required number min="0" ng-model="data.area_discount" name="area_discount" class="form-control" id="inputAreaSalePercent"
                   placeholder="区域折扣" />

            <span role="alert" ng-show="(contractEditProductForm.$submitted || contractEditProductForm.area_discount.$touched) && contractEditProductForm.area_discount.$error.required"
                  class="error ng-hide c-red lh30">区域折扣不能为空</span>
            <span role="alert" ng-show=" contractEditProductForm.area_discount.$error.number" class="error ng-hide c-red lh30">区域折扣必须是数值类型</span>
            <span role="alert" ng-show=" contractEditProductForm.area_discount.$error.min" class="error ng-hide c-red lh30">区域折扣必须大于等于0</span>
        </div>

        <span class="col-sm-3 control-label">当次优惠折扣(%)</span>
        <div class="col-sm-9">
            <input type="number" required number min="0" ng-model="data.current_discount" name="current_discount" class="form-control" id="inputCurrentSalePercent"
                   placeholder="当次优惠折扣" />

            <span role="alert" ng-show="(contractEditProductForm.$submitted || contractEditProductForm.current_discount.$touched) && contractEditProductForm.current_discount.$error.required"
                  class="error ng-hide c-red lh30">当次优惠折扣不能为空</span>
            <span role="alert" ng-show=" contractEditProductForm.current_discount.$error.number" class="error ng-hide c-red lh30">当次优惠折扣必须是数值类型</span>
            <span role="alert" ng-show=" contractEditProductForm.current_discount.$error.min" class="error ng-hide c-red lh30">当次优惠折扣必须大于等于0</span>
        </div>
    </div>
    <div class="form-group mt10 clearfix">
        <span class="col-sm-3 control-label">当次实际折扣(%)</span>
        <div class="col-sm-9">
            <input type="number" required number min="0" ng-disabled="true" ng-model="data.current_real_discount" name="current_real_discount" class="form-control" id="inputCurrentRealSalePercent"
                   placeholder="当次实际折扣" />

            <span role="alert" ng-show="(contractEditProductForm.$submitted || contractEditProductForm.current_real_discount.$touched) && contractEditProductForm.current_real_discount.$error.required"
                  class="error ng-hide c-red lh30">当次实际折扣不能为空</span>
            <span role="alert" ng-show=" contractEditProductForm.current_real_discount.$error.number" class="error ng-hide c-red lh30">当次实际折扣必须是数值类型</span>
            <span role="alert" ng-show=" contractEditProductForm.current_real_discount.$error.min" class="error ng-hide c-red lh30">当次实际折扣必须大于等于0</span>
        </div>
        <span for="inputtext3" class="col-sm-3 control-label">结算金额</span>
        <div class="col-sm-9">
            <input type="text" class="fl form-control" style="width:100%" required name="settlement_amount" ng-model="data.settlement_amount"
                placeholder="结算金额"
            />
            <span role="alert" ng-show="(contractEditProductForm.$submitted || contractEditProductForm.settlement_amount.$touched)"
                class="error c-red lh30">
                <span ng-show="contractEditProductForm.settlement_amount.$error.required">
                    结算金额不能为空
                </span>
            </span>
        </div>
    </div>
    <div class="form-group mt10 clearfix" ng-if="!isSpecialContract">
        <span for="inputtext3" class="col-sm-3 control-label">签约金额</span>
        <div class="col-sm-9">
            <input type="text" class="fl form-control" style="width:100%" required name="sign_amount" ng-model="data.sign_amount"
                placeholder="签约金额"
            />
            <span role="alert" ng-show="(contractEditProductForm.$submitted || contractEditProductForm.sign_amount.$touched)"
                class="error c-red lh30">
                <span ng-show="contractEditProductForm.sign_amount.$error.required">
                    签约金额不能为空
                </span>
            </span>
        </div>
    </div>
    <div class="ui-dialog-footer mt40" style="padding-bottom: 0">
        <div class="ui-dialog-button" style="padding-bottom: 0">
            <button class="ui-dialog-autofocus" ng-click="!contractEditProductForm.$invalid &amp;&amp; onResolve()">确定</button>
            <button ng-click="onReject()">取消</button>
        </div>
    </div>
</form>